/**
 * 
 */
package com.seedwill.common.query.page;

import java.util.List;
import java.util.Map;

import com.seedwill.common.view.IPagnationView;

/**
 * 分页扩展
 * 
 * @author kdyi
 *
 */
public class ExtPage extends APage implements IExtPage {
	/**
	 * 构造器
	 * @param count
	 * @param currPage
	 */
	public ExtPage(int count , int currPage) {
		super(count, currPage);
		
	}
	/**
	 * 构造器
	 * @param count
	 * @param currPage
	 * @param preferSize
	 */
	public ExtPage(int count, int currPage , int preferSize) {
		super(count, currPage, preferSize);
		
	}
//	private int start;
	private int end;

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#getTotalPage()
	 */
	public int getTotalPage() {
		return pageCount;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setTotalPage(int)
	 */
	public void setTotalPage(int totalPage) {
		pageCount = totalPage;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#getTotalRs()
	 */
	public int getTotalRs() {
		return count;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setTotalRs(int)
	 */
	public void setTotalRs(int totalRs) {
		this.count = totalRs;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#getEnd()
	 */
	public int getEnd() {
		return this.end;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setEnd(int)
	 */
	public void setEnd(int end) {
		this.end = end;
	}
	
	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#evalPageEnd()
	 */
	public int evalPageEnd(){
		//int end = getStartIndex() + getPageSize() - 1;
		int end = getStartIndex() + getPageSize();
        if (end > getCount()) {
            end = getCount();
        }
        return end;
	}
	/* (non-Javadoc)
	 * @see cn.gov.zjport.webapp.core.util.Page#getPageSize()
	 */
	public int getPageSize() {
		return pageSize;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setPageSize(int)
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#getStart()
	 */
	public int getStart() {
		return this.startIndex;
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setStart(int)
	 */
	public void setStart(int start) {
		startIndex = start;
	}
	
	/**
	 * 
	 */
	private List list;

	/**
	 * @return
	 */
	public List getList() {
		return list;
	}

	/**
	 * @param list
	 */
	public void setList(List list) {
		this.list = list;
	}
	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#getCurrentPageNo()
	 */
	public int getCurrentPageNo() {
		return super.getCurrPage();
	}

	/* (non-Javadoc)
	 * @see cn.gov.zjport.service.flight.core.ExtServerPage#setCurrentPageNo(int)
	 */
	public void setCurrentPageNo(int currentPageNo) {
		super.currPage = currentPageNo;
	}


}
